package mobi.greenplate.theweb.converter;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.util.Date;

import mobi.greenplate.theweb.domain.Community;
//for : enum types (and many-to-one)



@XmlRootElement(name = "community")
public class CommunityConverter {
    private final Community entity;

    public CommunityConverter() {
        this.entity = new Community();
    }

    public CommunityConverter(Community entity) {
        this.entity = entity;
    }
    
    @XmlTransient
    public Community getEntity(){
        return entity;
    }

    @XmlElement
    public Long getId() {
        return entity.getId();
    }

    public void setId(Long id) {
        entity.setId(id);
    }
    
    @XmlElement
    public String getGroupName() {
        return entity.getGroupName();
    }
    
    public void setGroupName(String groupName) {
        entity.setGroupName(groupName);
    }

    @XmlElement
    public UserConverter getOwner() {
        return new UserConverter(entity.getOwner());
    }

    public void setOwner(UserConverter userConverter) {
        entity.setOwner(userConverter.getEntity());
    }

    @XmlElement
    public FriendListConverter getFriends() {
        return new FriendListConverter(entity.getFriends());
    }

    public void setFriends(FriendListConverter friendListConverter) {
        entity.getFriends().addAll(friendListConverter.getEntities());
    }    
   
}

